#ifndef ROOM_HH
#define ROOM_HH
/*The Room class manages game locations as nodes in the dungeon, handling room attributes (name, description, connections), enemy/item storage, 
and dynamic state tracking (cleared/explored status). 
It supports room types (combat, shop, treasure) with specialized behaviors: combat rooms track enemies (auto-removing dead ones),
shops manage item stock (with memory-safe handling of static/predefined items), and treasure rooms trigger reward selection. 
The class provides methods to describe room contents (enemies, items, exits), enforce type-specific interactions (e.g., shop prompts), 
and maintain gameplay state (marking cleared/visited rooms), while ensuring proper memory management for dynamically allocated enemies/items.
*/
/*
* Room类作为地牢节点管理游戏场景，主要功能：
* - 房间属性管理：名称、描述、连接关系
* - 动态实体存储：敌人/物品容器
* - 状态追踪：已清除/已探索状态
* 支持特色房间类型：
* 1. 战斗房间：
*   - 敌人追踪（自动移除死亡单位）
* 2. 商店房间：
*   - 物品库存管理（静态/预定义物品内存安全处理）
* 3. 宝藏房间：
*   - 奖励选择触发
* 提供：
* - 房间内容描述（敌人、物品、出口）
* - 类型专属交互（如商店提示）
* - 游戏状态维护（标记已清除/访问房间）
* - 动态内存管理（敌人/物品安全释放）
*/
#include <string>
#include <vector>
#include <map>
#include "Enemy.hh"
#include "Item.hh"


namespace DungeonRPG {

enum class RoomType {
    Normal,
    Combat,
    Shop,
    Treasure
};

class Room {
private:
    std::string name;
    std::string description;
    std::vector<Item*> items;
    std::vector<Enemy*> enemies;
    std::map<std::string, Room*> connections;
    bool explored = false;
    bool cleared = false;
    RoomType type = RoomType::Normal;
    std::vector<Item*> shopStock;

public:
    Room(const std::string& name, const std::string& description);
    ~Room();
    void addItem(Item* item);
    void addEnemy(Enemy* enemy);
    void addConnection(const std::string& direction, Room* room);
    Room* getConnectedRoom(const std::string& direction) const;

    void describe() const;
    std::vector<Item*>& getItems();
    std::vector<Enemy*>& getEnemies();
    void removeDeadEnemies();

    void markExplored();
    bool isExplored() const;

    void markCleared();
    bool isCleared() const;

    void setType(RoomType t);
    RoomType getType() const;

    void setShopStock(const std::vector<Item*>& stock);
    const std::vector<Item*>& getShopStock() const;
    void removeShopItem(int index);
};

}

#endif
